/*

	This file loads data on export support, delivered by the Trade Council in Denmark
	It was delivered in two parts:
	 - promodata.dta: includes all cases where the firm purchased export support
	 - tdc.dta: turned-down cases, included all cases where contact between the TC and the firm was established,
	   but where the firm did not end up purchasing support
	In both data sets, the variable "tdcinitiative" is a dummy variable that takes value 1 if the firm was
	contacted by the TC and zero otherwise.

*/

cd ${work}1_data

*LOAD
use input\promodata, clear

*APPEND 
*("treated" is a dummy variable that takes value 1 if the firm purchased support and zero otherwise)
gen treated=1
append using input\tdc
replace treated=0 if treated==.

*MODIFY
keep jurnr land year product treated tdcinitiative itemvalue discountpct
keep if year>=2002 & year<=2015
keep if land!=""

rename jurnr jurnr_num

*"itemvalue" is the list price for the given support service (in DKK)
*"discountpct" is the discount (in pct.) issued to the firm
*construct "discount" as the discount in DKK.
gen discount = discountpct/100 * itemvalue
drop discountpct

*convert from dkk to 1000 dkk
replace itemvalue = itemvalue / 1e3
replace discount = discount / 1e3

*COLLAPSE
*we do not distinguish multiple support purchases within a year
collapse (max) treated tdcinitiative (sum) itemvalue discount , by(jurnr_num land year product)

*SAVE
order jurnr land year product treated tdcinitiative itemvalue discount
sort jurnr land year product
compress
save output\promotion, replace